var stepId = $CertusJsonAjax.getStepInstanceId();
var processId = $CertusJsonAjax.getProInstanceId();
$CertusFormAjax.ajax('findPlanInfo',{"processId":processId},function (response) {
    var data = response.data;
    var plans = data.plans;
    var tripUsers = data.tripUsers;
    $$scope.stUserName = tripUsers.userName;

    $$scope.bugetList = data.bugetList;
    $$scope.proName = plans.proj_name;
    $$scope.tripNum = plans.trip_num;
    $$scope.userName = plans.user_name;
    $$scope.planStime =plans.planStarTime;
    $$scope.planEtime = plans.planEndTime;
    $$scope.planCity = plans.plan_city;
    $$scope.planComments = plans.plan_comments;
    $$scope.id = plans.id;
    $$scope.tripResult = plans.trip_result;
    $$scope.actualStarTime = plans.actual_star_time;
    $$scope.actualEndTime = plans.actual_end_time;
    $$scope.proId = plans.pro_id;
    $$scope.optionMsg = plans.opinion_msg;
    $$scope.deptName = plans.department_name;
    if(plans.type==1){
        $$scope.type ="出差";
    }else{
        $$scope.type ="公干";
    }
});
//查询审批人职位
$CertusFormAjax.ajax('getSpPosition',{},function (response) {
    var data = response.data;
    $$scope.position = data;
});

$(".agree").on('click',function () {
    $CertusFormAjax.ajax('deptAgreeMgSp',{"id":$$scope.id,"proId":$$scope.proId,"stepId":stepId,
        "optionMsg":$("#optionMsg").val(),"lcCode":"NCCLC2"},function () {
        layer.msg("审批成功！");
        window.history.back();
    });
});
$(".unagree").on('click',function () {
    $CertusFormAjax.ajax('unagreeMgSp',{"id":$$scope.id,"stepId":stepId,
        "optionMsg":$("#optionMsg").val(),"lcCode":"NCCLC2"},function () {
        layer.msg("审批成功！");
        window.history.back();
    });
});
